package org.cyberz.jsm;


/**
 * An exception thrown when input is not handler by any method.
 * 
 * @author Andrea Leofreddi
 */
public class UnhandledInput extends Throwable {
	private static final long serialVersionUID = 1L;
	
	private static String getMessage(String name, Class<?>[] parameterTypes) {
		StringBuilder sb = new StringBuilder(name);
		
		sb.append('(');
		
		for(int i = 0; i < parameterTypes.length;) {
			sb.append(parameterTypes[i].getClass().getName());
			
			i++;
			
			if(i != parameterTypes.length)
				sb.append(", ");
		}
		
		sb.append(')');
		
		return sb.toString();
	}
	
	public UnhandledInput(String name, Class<?>[] parameterTypes) {
		super(getMessage(name, parameterTypes));
	}
}
